#pragma once
#include <windows.h>
#ifdef __cplusplus
extern "C"{
#endif
void k_console(void)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;

    // Create a new console window.
    if (!AllocConsole()) return;

    // Set the screen buffer to be larger than normal (this is optional).
    if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
    {
        csbi.dwSize.Y = 1000; // any useful number of lines...
        SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), csbi.dwSize);
    }


    // Redirect "stdin" to the console window.
    if (!freopen("CONIN$", "w", stdin)) return;


    // Redirect "stderr" to the console window.
    if (!freopen("CONOUT$", "w", stderr)) return;

    // Redirect "stdout" to the console window.
    if (!freopen("CONOUT$", "w", stdout)) return;


    // Turn off buffering for "stdout" ("stderr" is unbuffered by default).

    setbuf(stdout, NULL);


}
#ifdef __cplusplus
}
#endif
